const h1 = document.createElement('h1')
h1.innerHTML = 'webpack dev server'

document.body.appendChild(h1)

const ul = document.createElement('ul')
document.body.appendChild(ul)

h1.addEventListener('click', () => {
  fetch('/api/users')
    .then(res => res.json())
    .then(data => {
      data.forEach(item => {
        const li = document.createElement('li')
        li.textContent = item.login
        ul.append(li)
      });
    })
})
